package com.hj.aimin.auth.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.github.yulichang.annotation.EntityMapping;
import com.hj.aimin.ds.annotation.DictTranslate;
import lombok.Data;

import java.util.List;

@Data
@TableName("t_user")
public class User {
    @TableField("id")
    private int id;

    @TableField("pid")
    private int pid;

    @TableField("username")
    private String username;

    @TableField("password")
    private String password;

    @TableField("sex")
    @DictTranslate(valueTo = "sexName")
    private int sex;

    @TableField(exist = false)
    private String sexName;

    @TableField(exist = false)
    @EntityMapping(thisField = "id",joinField = "pid")
    private User parent;

    /**
     * 查询地址 (一对多)
     */
    @TableField(exist = false)
    @EntityMapping(thisField = "id", joinField = "userId")
    private List<Address> addressList;
}
